/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upf.grupoe.p2ppicture.DBAccessEngine.implementations;

import edu.upf.grupoe.p2ppicture.DBAcessEngine.Interfaces.DBActionResult;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Alberto Llor
 * NIA 69808
 * 
 */
public class DBActionResultImpl implements DBActionResult {

    // we define the private parameters
    private boolean isValid;
    //private List<Results> queryResultList=null;
    private String MessageError=null;
    private Throwable excep;
    private List<Photo> Result = new ArrayList<Photo>();

    public DBActionResultImpl(boolean b){
        isValid = b;
        //this.queryResultList = new ArrayList();
    }

    public DBActionResultImpl(boolean b, String err, Throwable exception){
        isValid = b;
        MessageError = err;
        excep = exception;
        Result = null;
    }
  
    public boolean isOk() {
        return isValid;
    }
    
    public String getErrorMsg() {
        return MessageError;
    }

    public Throwable getException() {
        return excep;
    }

    public List<Photo> getResult() {
        return Result;
    }

    public void setErrorMsg(String e) {
        MessageError=e;
    }

    public void setException(Throwable t) {
        excep=t;
    }

    public void setResult(List<Photo> l) {
       
            if (Result.isEmpty()){
                Result = l;
        } else {
            Result.clear();
            Result = l;
        }
    }  
}